package com.ft.security.model;

import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @copyright (C), 2015-2019, XXX有限公司
 * @fileName: JwtUser
 * @author: 李阳
 * @date: 2019/7/1 22:50
 * @description: Jwt用户实体
 * @history: <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
public class JwtUser extends User {

    private static final long serialVersionUID = -963092281896855988L;

    @Getter
    private Long id;

    @Getter
    private Long companyId;

    @Getter
    private Long deptId;

    @Getter
    private Long tenantId;

    @Getter
    private Integer userType;

    public JwtUser(Long id, Long companyId, Long deptId,
                   Long tenantId, String username, String password, Integer userType,
                   Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
        this.id = id;
        this.companyId = companyId;
        this.deptId = deptId;
        this.tenantId = tenantId;
        this.userType = userType;
    }

    public JwtUser(Long id, Long companyId, Long deptId,
                   Long tenantId, String username, String password, Integer userType,
                   boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired,
                   boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.id = id;
        this.companyId = companyId;
        this.deptId = deptId;
        this.tenantId = tenantId;
        this.userType = userType;
    }
}
